<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\widgets\Select2;
/* @var $this yii\web\View */
/* @var $model backend\module\shop\models\GoodsCategory */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="goods-category-form">

    <?php 
        $form = ActiveForm::begin([
                    'options' => [
                        'class' => 'form-horizontal'
                    ],
                    'fieldConfig' => [
                        'template' => '{label}<div class="col-lg-7">{input}{hint}</div><div class="col-lg-3">{error}</div>',
                        'labelOptions' => ['class' => 'col-lg-2 control-label'],
                    ]
                ]);    
    ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
    
    <?=$form->field($model,'parent')->widget(Select2::className(),[
        'data' => $selectData,
        'name' => 'parent',
        'options' => ['placeholder' => Yii::t('common', 'Select ...')],
    ]) ?>

    <?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'sort')->textInput() ?>


    <?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>

  
	<?php if (!Yii::$app->request->isAjax){ ?>
	  	<div class="form-group">
                    <div class="col-lg-2"></div>
                    <div class="col-lg-7"><?= Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => 'btn btn-primary']) ?></div>
	    </div>
	<?php } ?>

    <?php ActiveForm::end(); ?>
    
</div>
